package  com.NeuglsWorkStudio.UI.Buttons
{
	
	import flash.display.DisplayObject;
	import flash.events.EventDispatcher;
	import flash.events.MouseEvent;
	
	public class TCheckButton extends TIconButton
	{
		[Embed(source="images/Button/CheckBtnChecked.png")]
		private var _FCheckedIcon:Class;
		
		[Embed(source="images/Button/CheckBtnNoChecked.png")]
		private var _FNoCheckedIcon:Class;
		
		private var _FID:Number=Number(-1);
		
		
		public function TCheckButton(ACaption:String="")
		{
			super(ACaption);
			
			this.IconSize=20;
			this.IconTextMargin=2;
			this.CheckedIcon= new _FCheckedIcon() as DisplayObject;
			this.NoCheckedIcon = new _FNoCheckedIcon() as DisplayObject;
		}
		
		public function get ID():Number
		{
			return _FID;
		}
		
		public function set ID(value:Number):void
		{
			_FID = value;
		}
		override protected function FClick(Event:MouseEvent):void{
			super.FClick(Event);
			this.Checked=!this.Checked;
			
			var _FCheckEvent:TCheckButtonEvent = new TCheckButtonEvent(TCheckButtonEvent.CHECKBTNCLICK);
			_FCheckEvent.ID=this._FID;
			dispatchEvent(_FCheckEvent);			
		}

	}
}